package com.bnuz.vtl.repo;

import com.bnuz.vtl.model.PublicNode;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface PublicNodeRepo extends Neo4jRepository<PublicNode, String>, BaseRepo<PublicNode, String> {

    @Query("MATCH (N:PublicNode)<-[:CHILD*]-(M:PublicNode) WHERE M.publicNodeId = {publicNodeId} RETURN N")
    PublicNode getParent(@Param("publicNodeId") String publicNodeId);

}
